import React from 'react';
import Image from 'next/image';
import Link from 'next/link';
import { Button } from '@/components/ui/button';
import { auth } from '@/auth';
import { redirect } from 'next/navigation';

export default async function Home() {
  // 获取用户会话状态
  const session = await auth();
  
  // 暂时取消重定向逻辑
  // if (session && session.user) {
  //   redirect('/dashboard');
  // }
  return (
    <main className="flex min-h-screen flex-col items-center justify-center p-8">
      <div className="container mx-auto max-w-6xl">
        <div className="flex flex-col items-center text-center mb-12">
          <h1 className="text-4xl font-bold text-center mb-4">
            欢迎来到 NextCollab 协作平台
          </h1>
          <p className="text-xl max-w-2xl mb-8">
            高效管理项目、任务和团队协作的一站式解决方案
          </p>
          <div className="flex gap-4">
            <Link href="/auth/login" passHref>
              <Button variant="default" size="lg">
                立即登录
              </Button>
            </Link>
            <Link href="/auth/register" passHref>
              <Button variant="outline" size="lg">
                注册账号
              </Button>
            </Link>
          </div>
        </div>

        <div className="grid grid-cols-1 md:grid-cols-3 gap-8">
          <div className="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md">
            <div className="mb-4 flex justify-center">
              <Image 
                src="/file.svg" 
                alt="项目管理" 
                width={48} 
                height={48}
                unoptimized
              />
            </div>
            <h2 className="text-xl font-bold mb-2 text-center">项目管理</h2>
            <p className="text-gray-600 dark:text-gray-400 text-center">
              创建和管理项目，设置里程碑和目标，追踪进度
            </p>
          </div>
          
          <div className="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md">
            <div className="mb-4 flex justify-center">
              <Image 
                src="/window.svg" 
                alt="任务看板" 
                width={48} 
                height={48}
                unoptimized
              />
            </div>
            <h2 className="text-xl font-bold mb-2 text-center">任务看板</h2>
            <p className="text-gray-600 dark:text-gray-400 text-center">
              可视化工作流程，拖放任务卡片，实时更新状态
            </p>
          </div>
          
          <div className="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md">
            <div className="mb-4 flex justify-center">
              <Image 
                src="/globe.svg" 
                alt="团队协作" 
                width={48} 
                height={48}
                unoptimized
              />
            </div>
            <h2 className="text-xl font-bold mb-2 text-center">团队协作</h2>
            <p className="text-gray-600 dark:text-gray-400 text-center">
              邀请团队成员，分配任务，实时沟通和协作
            </p>
          </div>
        </div>
      </div>
    </main>
  );
}
